package com.easemob.cases.db;

import org.xutils.db.annotation.Column;
import org.xutils.db.annotation.Table;

/**
 * Created by King on 2016/8/8 0008.
 */
@Table(name = "messagenews")
public class MessageInviteTable {
    static final String COLUMN_NAME_ID = "id";
    @Column(name = "id",isId = true)
    private int id;
    static final String COLUMN_NAME_FROM = "username";
    @Column(name = "username")
    private String userName;
    static final String COLUMN_NAME_GROUP_ID = "groupid";
    @Column(name = "groupid")
    private String groupID;
    static final String COLUMN_NAME_GROUP_Name = "groupname";
    @Column(name = "groupname")
    private String groupName;
    static final String COLUMN_NAME_TIME = "time";
    @Column(name = "time")
    private long time;
    static final String COLUMN_NAME_REASON = "reason";
    @Column(name = "reason")
    private String reason;
    static final String COLUMN_NAME_STATUS = "status";
    @Column(name = "status")
    private int status;
    static final String COLUMN_NAME_ISINVITEFROMME = "isinvitefromme";
    @Column(name = "isinvitefromme")
    private int isInviteFromMe;
    static final String COLUMN_NAME_GROUPINVITER = "groupinviter";
    @Column(name = "groupinviter")
    private String groupInviter;
    static final String COLUMN_NAME_UNREAD_MSG_COUNT = "unreadmsgcount";
    @Column(name = "unreadmsgcount")
    private int unReadMsgCount;

    private InviteMessageStatus statusFlag;
    public enum InviteMessageStatus{

        //==contact
        /**being invited*/
        BEINVITEED(0),
        /**being refused*/
        BEREFUSED(1),
        /**remote user already agreed*/
        BEAGREED(2),

        //==group application
        /**remote user apply to join*/
        BEAPPLYED(3),
        /**you have agreed to join*/
        AGREED(4),
        /**you refused the join request*/
        REFUSED(5),

        //==group invitation
        /**received remote user's invitation**/
        GROUPINVITATION(6),
        /**remote user accept your invitation**/
        GROUPINVITATION_ACCEPTED(7),
        /**remote user declined your invitation**/
        GROUPINVITATION_DECLINED(8);


        private int iNum = 0;
        private InviteMessageStatus(int num){
            this.iNum = num;
        }
        public int toNumber(){
            return iNum;
        }
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getGroupID() {
        return groupID;
    }

    public void setGroupID(String groupID) {
        this.groupID = groupID;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getIsInviteFromMe() {
        return isInviteFromMe;
    }

    public void setIsInviteFromMe(int isInviteFromMe) {
        this.isInviteFromMe = isInviteFromMe;
    }

    public String getGroupInviter() {
        return groupInviter;
    }

    public void setGroupInviter(String groupInviter) {
        this.groupInviter = groupInviter;
    }

    public int getUnReadMsgCount() {
        return unReadMsgCount;
    }

    public void setUnReadMsgCount(int unReadMsgCount) {
        this.unReadMsgCount = unReadMsgCount;
    }

    public InviteMessageStatus getStatusFlag() {
        return statusFlag;
    }

    public void setStatusFlag(InviteMessageStatus statusFlag) {
        this.statusFlag = statusFlag;
    }

    @Override
    public String toString() {
        return "MessageInviteTable{" +
                "id=" + id +
                ", userName='" + userName + '\'' +
                ", groupID='" + groupID + '\'' +
                ", groupName='" + groupName + '\'' +
                ", time='" + time + '\'' +
                ", reason='" + reason + '\'' +
                ", status=" + status +
                ", isInviteFromMe=" + isInviteFromMe +
                ", groupInviter='" + groupInviter + '\'' +
                ", unReadMsgCount=" + unReadMsgCount +
                '}';
    }
}
